package memberRegistrationSys;

import java.util.Scanner;

/**
 * 会员注册类
 * @author yy
 *
 */

public class MemberRegistration2 {
	boolean flag = false;
	public boolean judge(String name, String passWord1, String passWord2){
		if (name.length() < 3 || passWord1.length() < 6) {
			System.out.println("用户名长度不能小于3，密码长度不能小于6！");
			flag = false;
		} else {
			if (passWord1.equals(passWord2)) {
				System.out.println("注册成功！请牢记用户名和密码。");
				flag = true;
			} else {
				System.out.println("两次输入的密码不相同！");
				flag = false;
			}
		}
		return flag;
	}

	public static void main(String[] args) {
		MemberRegistration2 memRgs = new MemberRegistration2();
		Scanner input = new Scanner(System.in);
		System.out.println("****欢迎进入注册系统****");
		boolean answer = false;
		do {
			System.out.println("请输入用户名：");
			String name = input.next();
			System.out.println("请输入密码：");
			String passWord1 = input.next();
			System.out.println("请再次输入密码：");
			String passWord2 = input.next();
			answer = memRgs.judge(name, passWord1, passWord2);
		} while (!answer);
	}
}
